package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbClbb;
import com.ruoyi.tjbb.service.ISysTjbbClbbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 车辆查询Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/cljl/clbb")
public class SysTjbbClbbController extends BaseController
{
    @Autowired
    private ISysTjbbClbbService sysTjbbClbbService;

    /**
     * 查询车辆查询列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/cljl:clbb:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbClbb sysTjbbClbb)
    {
        startPage();
        List<SysTjbbClbb> list = sysTjbbClbbService.selectSysTjbbClbbList(sysTjbbClbb);
        return getDataTable(list);
    }

    /**
     * 导出车辆查询列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/cljl:clbb:export')")
    @Log(title = "车辆查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbClbb sysTjbbClbb)
    {
        List<SysTjbbClbb> list = sysTjbbClbbService.selectSysTjbbClbbList(sysTjbbClbb);
        ExcelUtil<SysTjbbClbb> util = new ExcelUtil<SysTjbbClbb>(SysTjbbClbb.class);
        util.exportExcel(response, list, "车辆查询数据");
    }

    /**
     * 获取车辆查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/cljl:clbb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbClbbService.selectSysTjbbClbbById(id));
    }

    /**
     * 新增车辆查询
     */
    @PreAuthorize("@ss.hasPermi('tjbb/cljl:clbb:add')")
    @Log(title = "车辆查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbClbb sysTjbbClbb)
    {
        return toAjax(sysTjbbClbbService.insertSysTjbbClbb(sysTjbbClbb));
    }

    /**
     * 修改车辆查询
     */
    @PreAuthorize("@ss.hasPermi('tjbb/cljl:clbb:edit')")
    @Log(title = "车辆查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbClbb sysTjbbClbb)
    {
        return toAjax(sysTjbbClbbService.updateSysTjbbClbb(sysTjbbClbb));
    }

    /**
     * 删除车辆查询
     */
    @PreAuthorize("@ss.hasPermi('tjbb/cljl:clbb:remove')")
    @Log(title = "车辆查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbClbbService.deleteSysTjbbClbbByIds(ids));
    }
}
